home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 9
/
Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO
/
019a
/
kws133.zip
/
KWS.DOC
< prev
next >
Wrap
Text File
|
1993-04-23
|
20KB
|
466 lines
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 1
DESCRIPTION
-----------
KWS (KeyWord Search) is a small, fast program that performs logical
AND/OR/NOT searches for keywords within one or more text or binary
files. KWS has many features and options, including:
* Prefix, suffix, and whole word searches.
* Case-sensitive searches.
* Adjustable fuzzy searches.
* Subdirectory searches.
* Highlight keywords in bold onscreen.
* Display line numbers or file offset position.
* Display total lines found per file and per search.
* Wildcard filename searches.
* Read data from standard input.
* Read/write filenames from/to a file list.
* Search hidden and system files.
* Stop search after a specified number of matches.
* Smart pause that detects your screen size.
* Adjustable window size for searching groups of lines.
* Display files onscreen while routing to a device or file.
* Strip control characters from text files.
* Search/convert text files created on other platforms.
* Accepts input lines up to 2k in length.
* Accepts 4DOS 256-character command lines.
* Runs on any PC compatible using DOS 2.0 or higher.
DISCLAIMER
----------
KWS is distributed on an "AS IS" basis without warranty, expressed or
implied. Considerable testing effort has been expended, but the user
is advised to check the program's suitability before relying on it.
The user assumes full risk as to the results of using this program. In
no event shall the author be liable for any incidental or consequent-
ial damages arising from the use, or inability to use this program.
REGISTRATION
------------
The unregistered version of KWS is freely distributable and fully
functional, and may be used for a 30-day trial period. If you plan to
continue using KWS, you are obligated to pay the modest registration
fee. Registered users will receive a serialized, nag-free version of
KWS, a free upgrade when available, and $5 subsequent upgrades.
All registration information is contained in the KWS.REG file. If that
file is missing, register by sending your name and address (please
print), along with $20 (cash, check, or money order in US funds) to:
Copy Con Incorporated
PO Box 23255
Baltimore MD 21203-5255
Please specify 3.5" or 5.25" diskette. MD residents add 5% sales tax.
Thank you for supporting Shareware.
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 2
OPERATION
---------
KWS is activated from the command line, using the format
KWS [@]filename search_string[...] [options]
Parameters surrounded by [brackets] are optional.
The @ symbol, if used, must be directly followed by the name of a text
file containing valid filespecs; the files to be searched will be read
from that file list. Each filespec in the file list will be searched
relative to the current directory. (File lists can be created with KWS
using the /M option; see OPTIONS.)
If the @ symbol is not used, the filename is the filespec to be
searched. Wildcards are optional. (For a description of wildcards and
filespecs, see your DOS manual.)
Each search string is comprised of keywords separated by semicolons.
At least one keyword from each search string must be present in a
given line for it to be displayed; for example,
KWS allfiles.lst fixed;hard disk;drive
will display the lines in file ALLFILES.LST that contain either words
FIXED or HARD (or both), and also contain either words DISK or DRIVE.
If a search string contains a keyword with embedded spaces, the entire
search string must be enclosed in quotes; for example,
KWS temp.bat "del *;era *"
will search TEMP.BAT for phrases "del *" or "era *" (without quotes).
A logical 'NOT' search can be conducted by preceding a keyword with
an exclamation (!) character; for example,
KWS stuff.txt this !that
will display the lines in STUFF.TXT that contain the word THIS and not
the word THAT. If you wish to search for an exclamation as the first
(or only) character of a keyword, use two in a row; for example,
KWS stuff.txt this !!that
will display lines that contain both words THIS and !THAT. Exclamation
characters inside or following keywords (as in " HEY! " or " What!? ")
do not have to be doubled.
A fuzzy search can be conducted by preceding a keyword with a tilde
(~) character; lines with words that are similar to the keyword will
be displayed. This option is useful if you aren't sure of a keyword's
correct spelling, or if a keyword may be spelled incorrectly in the
files to be searched. for example,
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 3
OPERATION (continued)
---------------------
KWS gnu.txt ~copyrite
will display lines with words similar to COPYRITE. (The similarity
percentage can be adjusted with the /F option; see OPTIONS.) If you
wish to combine a fuzzy search with a logical 'NOT' search, use the
'NOT' character before the tilde (as in " !~THE "). Fuzzy searches
cannot be combined with prefix/suffix/whole word searches (described
below).
Whole word searches can be conducted by putting underscore (_)
characters before and after the keyword; for example,
KWS files.lst _c_ source
will display lines in FILES.LST that contain a lone 'C' and the word
SOURCE. Similarly, prefixes can be searched for by putting an
underscore before a keyword, and suffixes can be searched for by
putting an underscore after a keyword. If you wish to search for an
underscore as the first or last (or only) character of a keyword, use
two underscores in a row, as with the logical 'NOT' exclamation
character above. If you wish to combine a prefix/whole word search
with a logical 'NOT' search, use the 'NOT' character before the
underscore (as in " !_the_ "). Prefix/suffix/whole word searches
cannot be combined with fuzzy searches (described above).
Up to 10 search strings are allowed, with up to 10 keywords per
string.
OPTIONS
-------
Options can appear anywhere on the command line after the filespec.
They can be in any order, and are not case-sensitive. Options can be
separated by spaces (/L3 /P /T) or strung together (/L3/P/T or /L3PT).
Option Description
/A When this option is used, all binary files will automatically
be shown with hexadecimal file offsets.
/B This option makes the keywords stand out from the rest of the
displayed line. When using this option, output cannot be
routed using DOS redirection; use the /O option for output.
/C Search will be case-sensitive. Case-sensitive searches are
approximately 20% faster than case-insensitive searches.
/D Control characters (ASCII value less than 32) within text
files will be replaced with spaces before being viewed or
routed.
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 4
OPTIONS (continued)
-------------------
/E The command line will be echoed as the first output line.
Useful mainly with redirected files to avoid repetition, and
for testing batch files.
/Fn This option controls the similarity percentage for fuzzy
searches. Similarity defaults to 65 percent, and can be
adjusted from 0 (display almost every line) to 100 (display
exact matches).
/H Hidden and/or system files will also be searched.
/I Ignore the KWS config file, if present (see CONFIG FILE). If
stringing options together, make sure that this option is the
first in the string; for example, use "/ip" instead of "/pi".
/Kc Change the keyword separator charactor from a semicolon to
the specified character. This option may be needed to pass
multiple keyword parameters to a batch file (as some versions
of DOS remove semicolons from batch parameters), or if a
semicolon is part of a keyword to be searched.
/L[n] Line numbers or file offset position will be displayed with
output. If the specified width begins with a zero, then the
file offset will be displayed; otherwise, line numbers will
be displayed. If no width is specified, the numbers will be
left-justified, with a colon between the number and the text;
otherwise, the numbers will be right-justified and zero-
padded to the left, followed by the colon and text. If the
specified width is too small for a number to fit, the number
will NOT be truncated.
/M[n] Stop searching after n matches per file. /M alone will cause
KWS to print only the filenames of successful searches, and
these can be redirected to a file to be used as a file list.
/Ofn Route output to the specified device/filename. Output will be
in addition to, not instead of, output displayed onscreen. To
route output without viewing, use DOS redirection instead of
this option (see your DOS manual for details). Do not append
other options on to the end of this option, as they will be
mistaken as part of the device/filename.
/P Pause between each screen of text. KWS will autodetect your
screen size, and pause accordingly. While paused, pressing
the 'C' key will display the current and any remaining files
continuously. Pressing the Escape key while paused will skip
the current file and go on to the next. This option will be
inactive when the /R option is used.
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 5
OPTIONS (continued)
-------------------
/R Instead of reading from text files, KWS will read from STDIN
(input is read from an input device or from another program's
output). When in this mode, the /P and /V options will be
inactive. Do not specify a filename when using this option.
/S Subdirectories will also be searched. This option is valid
only with wildcard and file list searches.
/T[n] Display total lines found per file. For wildcard and file
list searches, a grand total will also be displayed. If this
option is specified as "/t0", then only the totals will be
displayed, without the corresponding lines.
/V If KWS cannot determine if a file is binary or text, text
will be assumed; using this option will tell KWS to treat all
files as binary. This option is inactive when using the /R
option; KWS assumes standard input to be text.
/Wn Normally, all keywords must be on the same line for the line
to be displayed; use this option to look at more than one
line at a time. If all keywords are found within the
specified window size (maximum of 32767 lines), then the
lines will be displayed, starting with the first line to
contain a keyword, and ending with the last line to contain a
keyword. This option is inactive when searching binary files.
/X When this option is used, line numbers and offset positions
will be displayed in hexadecimal format instead of decimal.
CONFIG FILE
-----------
Under DOS 3.0 or higher, a configuration file can be used to specify
default option values. If a text file named KWS.CFG is in the same
directory as KWS.EXE, KWS will read default options from the CFG file.
KWS.CFG consists of one line of text using the format
OPTIONS = [options]
where [options] are the default options. As with command line options,
case is not important, and the options may be strung together.
Any options enabled in the config file can be disabled on the command
line by specifying the option with a minus sign appended, and the file
can be ignored completely by using the /I option. For example, with a
config file that reads
options=/b /p
bold keywords and screen pausing will be in effect whenever KWS is
run. To disable bold keywords, "/b-" can be specified on the command
line. To completely ignore the config file, specify "/i".
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 6
CONFIG FILE (continued)
-----------------------
KWS.CFG must be in the same directory as KWS.EXE. The config file can
be created with any ASCII text editor, or from the command line by
typing in the following two lines while in the KWS.EXE directory:
copy con kws.cfg
options=[options]
where [options] are whatever default options you wish. After typing
the two lines, press F6 or Control-Z, then press ENTER or RETURN.
EXAMPLES
--------
KWS catalog.lst dvorak keyboard /p
will take the lines in file CATALOG.LST that contain the words
DVORAK and KEYBOARD, and display them one screen at a time (P).
KWS catalog.lst arc;lzh shell /l5 /oprn
will take the lines in file CATALOG.LST that contain either ARC or
LZH, and also contain SHELL, and display them onscreen with line
numbers (L5), while sending them to the printer (OPRN).
KWS allfiles.lst /c !.ZIP >nozip.lst
will make a file called NOZIP.LST, which will contain all of the
lines in ALLFILES.LST that do NOT contain the word .ZIP in caps (C).
Output will not be seen onscreen.
KWS \dl\*.lst MIDI /ptc
will search all .LST files in the DL directory for the word MIDI in
capital letters (C), and displays the filenames and lines onscreen,
one screen at a time (P), with totals (T) for each file.
KWS *.bak _the_
will search the backup files for lines that contain the word THE,
but will not display them if THE is part of another word (as in
THESIS or OTHER).
KWS temp.bak _the_;!_the_ /b
will display every line in TEMP.BAK, hilighting (B) any occurrance
of the word THE.
KWS c:\*.bat _del;_era /s/h
will search all (S) of the batch files on the C: drive, including
those with their hidden and/or system attributes set (H), to see if
any of them delete/erase files.
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 7
EXAMPLES (continued)
--------------------
dir | KWS -92 /r
pipes the output from the DIR command into KWS (R), which will
display the directory entries from 1992.
KWS ; /r /l3 <one.txt >two.txt
creates file TWO.TXT which is a duplicate of file ONE.TXT, except
that TWO.TXT will have 3-digit line numbers (L3). (A search for the
keyword separator will find every line.)
KWS unix.man ; >unix.doc
converts a Unix format text file (LF delimited) into a DOS format
text file (CR/LF delimited). KWS can also read CR delimited files.
KWS *.doc ~copyrite /f70b
will search the .DOC files for words similar to COPYRITE, hilighting
any close calls (F70).
KWS *.doc ~copyrite !1993 /f70b
will display the same lines as the above example, except for lines
containing the word 1993.
KWS allfiles.lst _c_;assem;asm src;source /pb
will display all lines in ALLFILES.LST that have to do with C or
assembler source code. Keywords will be in bold (B), and output will
be paused after each screen (P).
KWS allfiles.lst _c_;assem;asm src;source !c++ /pb
will display the same as above, except C++ files will not be shown.
KWS \dl\*.gif GIFLITE /cm
looks inside of GIF files to see if any have been GIFLITEd, showing
the filenames (M) of those that have.
KWS \*.com ; /hal6p /od:com.txt
examines all (even hidden/system) .COM files in the root directory,
using hex (A) file offsets 6 characters wide (L6), pausing at each
screen (P), while also sending output to file COM.TXT on the D:
drive (OD:COM.TXT).
KWS p_simon.txt /cbw2 Ms;Miss;Mrs Robinson
will do a case-sensitive (C) search for Ms or Miss or Mrs Robinson,
and will display matches in bold (B), as long as Ms;Miss;Mrs is no
more than one line's distance (W2) from Robinson.
KWS kws.doc ; /pdolpt2
displays this file, one screen at a time (P), removing embedded
formfeed characters (D), while also sending output to printer LPT2
(OLPT2).
KWS V1.33 Copyright (c) 1991-1993 Copy Con Incorporated Page 8
EXAMPLES (continued)
--------------------
KWS c:\*.bat ; /sm >filelist.txt
will create a file named FILELIST.TXT containing the names of all
(S) of the batch files on the C: drive. This file is used in the
next example.
KWS @filelist.txt label "if %;goto"
will search the filenames in FILELIST.TXT, and display lines in
those files that contain the word LABEL and either the word GOTO or
the phrase "IF %" (without the quotes). Note that this example has
only two search strings, not three; if any words in a search string
contain spaces, then the entire search string must be in quotes.
RETURN CODES
------------
The DOS errorlevel will be set if a search is unsuccessful:
Level Description
1 Invalid command line options
2 None of the files contain the search string(s)
3 Ctrl-Break interrupt
4 Invalid directory specified
5 No files match filespec
6 Unable to open output file
SUPPORT
-------
If you have questions, comments, suggestions, bug reports, et cetera,
feel free to contact me by one of the following methods:
1: By modem at The Programmer's Corner (301-596-7692 or 410-995-6873).
Send a message to RD Thomas in the Shareware or General conference,
and check back in a couple of days for a reply.
2: On a BBS that carries the RIME Shareware conference (RD Thomas,
node ->1520). Allow at least one week for a reply.
3: By US Mail at the address given on the first page. If you would
like a reply, please include a self-addressed, stamped envelope.
Looking forward to hearing from you.
To print this document, type "COPY KWS.DOC PRN" at the DOS prompt.